package org.acme;

import io.smallrye.mutiny.Uni;
import io.vertx.core.json.JsonObject;
import org.acme.client.RestClient;
import org.acme.service.ReactiveGreetingService;
import org.reactivestreams.Publisher;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.logging.Logger;

@Path("weather")
public class ReactiveGreetingResource {
    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ReactiveGreetingResource.class.getName());

    @Inject
    ReactiveGreetingService service;

    @GET
    @Produces({MediaType.TEXT_PLAIN})
    @Path("/getByName/{name}")
//    @Operation(summary = "城市名称天气预报", description = "这是一个根据城市名称获取天气预报的接口")
    public Publisher<String> getByName(@PathParam("name") String name) {
        return service.getByName(name).convert().toPublisher();
    }
}
